handling unsupported lang switch gracefully#224
Conversation
📝 WalkthroughWalkthroughRefines unsupported-language error handling and updates language-switching behavior: language_detection now returns a user-facing error and logs a warning when a requested language is unsupported; pipecat_service appends explicit language-switching rules to the system prompt in multi-language mode; Kannada added to human-readable language map. Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
wavefront/server/apps/call_processing/call_processing/services/pipecat_service.py (1)
313-325: System prompt ordering differs between initial setup and post-switch.On initial setup (Line 321), the prompt is assembled as:
base → language_instruction → language_switching_rulesAfter a language switch in
language_detection_tool.py(Line 153 of that file), it becomes:
base + language_switching_rules → language_instructionThe section order flips. This is unlikely to cause functional problems since LLMs are order-insensitive for disjoint system prompt sections, but if you want consistency, you could reorder Line 321 to match the post-switch layout:
Optional: align initial ordering with post-switch ordering
- system_content = f'{base_system_prompt}\n\n{initial_language_instruction}{language_switching_rules}' + system_content = f'{base_system_prompt}{language_switching_rules}\n\n{initial_language_instruction}'🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@wavefront/server/apps/call_processing/call_processing/services/pipecat_service.py` around lines 313 - 325, The initial system prompt assembly order differs from the post-switch assembly; update the construction in pipecat_service.py so system_content and language_state['original_system_prompt'] use the same ordering as the post-switch behavior: concatenate base_system_prompt + language_switching_rules first, then append initial_language_instruction (i.e., make system_content = base_system_prompt + language_switching_rules + "\n\n" + initial_language_instruction) and store language_state['original_system_prompt'] using the same base_system_prompt + language_switching_rules ordering so it matches the language_detection_tool.py post-switch sequence.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In
`@wavefront/server/apps/call_processing/call_processing/services/pipecat_service.py`:
- Around line 313-325: The initial system prompt assembly order differs from the
post-switch assembly; update the construction in pipecat_service.py so
system_content and language_state['original_system_prompt'] use the same
ordering as the post-switch behavior: concatenate base_system_prompt +
language_switching_rules first, then append initial_language_instruction (i.e.,
make system_content = base_system_prompt + language_switching_rules + "\n\n" +
initial_language_instruction) and store language_state['original_system_prompt']
using the same base_system_prompt + language_switching_rules ordering so it
matches the language_detection_tool.py post-switch sequence.
There was a problem hiding this comment.
🧹 Nitpick comments (1)
wavefront/server/modules/voice_agents_module/voice_agents_module/utils/language_validation.py (1)
152-190:'kn'addition is correct; consider also adding other Nova-3 January 2026 languages.Deepgram's January 21, 2026 Nova-3 release added Kannada (
kn) alongside 11 other languages: Belarusian (be), Bengali (bn), Bosnian (bs), Croatian (hr), Macedonian (mk), Marathi (mr), Serbian (sr), Slovenian (sl), Tamil (ta), Tagalog (tl), and Telugu (te).Of those,
taandteare already inDEEPGRAM_STT_LANGUAGES, butbn,bs,hr,mk,mr,sr,sl,be, andtlare currently absent. Some of these (bn,mr) are already inSARVAM_LANGUAGESandCARTESIA_LANGUAGES, andtlis inCARTESIA_LANGUAGES, so their omission fromDEEPGRAM_STT_LANGUAGEScould cause false validation failures if those language codes are ever used with Deepgram STT.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@wavefront/server/modules/voice_agents_module/voice_agents_module/utils/language_validation.py` around lines 152 - 190, DEEPGRAM_STT_LANGUAGES is missing several languages added in Deepgram Nova-3 (Jan 21, 2026) which can cause false validation failures; update the DEEPGRAM_STT_LANGUAGES set to include the missing language codes: be, bn, bs, hr, mk, mr, sr, sl, tl (kn is already added and ta/te are present), then run unit/validation tests that exercise language acceptance in language_validation.py to ensure no regressions.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In
`@wavefront/server/modules/voice_agents_module/voice_agents_module/utils/language_validation.py`:
- Around line 152-190: DEEPGRAM_STT_LANGUAGES is missing several languages added
in Deepgram Nova-3 (Jan 21, 2026) which can cause false validation failures;
update the DEEPGRAM_STT_LANGUAGES set to include the missing language codes: be,
bn, bs, hr, mk, mr, sr, sl, tl (kn is already added and ta/te are present), then
run unit/validation tests that exercise language acceptance in
language_validation.py to ensure no regressions.
Summary by CodeRabbit
New Features
Bug Fixes